{{!
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*     http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}}

<div class="accordion-heading" {{action "onToggleBlock" view.category target="view"}}>
    <i class="pull-left accordion-toggle" {{bindAttr class="view.category.isCollapsed:icon-caret-right:icon-caret-down "}}></i>
    <a class="accordion-toggle">{{view.category.displayName}}</a>
</div>

<div {{bindAttr id="view.category.name"}} class="accordion-body collapse in">
    <div class="accordion-inner capacity-scheduler">
        <div class="row-fluid header">
            <div class="span1">{{t services.mapReduce.config.queue.header}}</div>
            <div class="offset9 span2">
                {{#if view.canEdit}}
                    <div class="btn pull-right" {{action queuePopup target="view"}}>{{t services.mapReduce.config.addQueue}}</div>
                {{/if}}
            </div>
        </div>
        <div>
            <table class="table table-bordered table-striped">
                <thead>
                <tr>
                    {{#each header in view.tableHeaders}}
                      <th>{{header}}</th>
                    {{/each}}
                </tr>
                </thead>
                <tbody>
                  {{#each queue in view.tableContent}}
                  <tr {{action queuePopup queue.name target="view"}}>
                      <td><a href="javascript:void(0)">
                          <i {{bindAttr style="queue.color"}} class="marker"></i>{{queue.name}}</a>
                      </td>
                      {{#each config in queue.configs}}
                        <td>{{config.value}}</td>
                      {{/each}}
                  </tr>
                  {{/each}}
                </tbody>
            </table>
        </div>
        <div class="row-fluid">
            <div class="span8">
                <div><strong>{{t common.advanced}}</strong></div>
                <form class="form-horizontal" autocomplete="off">
                  {{#each view.advancedConfigs}}
                    {{#if isVisible}}
                        <div class="row-fluid">
                            <div {{bindAttr class="errorMessage:error :control-label-span :span4"}}>
                                <label>{{displayName}}</label>
                            </div>
                            <div class="span8">
                                <div {{bindAttr class="errorMessage:error: :control-group"}}>
                                  {{view viewClass serviceConfigBinding="this" categoryConfigsBinding="view.categoryConfigs" }}
                                  {{#if view.canEdit}}
                                      {{#if App.isAdmin}}
                                        {{#if isRemovable}}
                                            <a class="action" {{action "removeProperty" this target="view" }} ><i class="icon-minus-sign"></i>{{t common.remove}}</a>
                                        {{/if}}
                                      {{/if}}
                                  {{/if}}
                                    <span class="help-inline">{{errorMessage}}</span>
                                </div>
                            </div>
                        </div>
                    {{/if}}
                  {{/each}}
                </form>
            </div>
            <div class="span4">
                <div class="frame">
                  <div id="section_label"></div>
                  {{view view.pieChart queuesBinding="view.queues"}}
                </div>
            </div>
        </div>
      {{! For Advanced, Advanced Core Site, Advanced HDFS Site sections, show the 'Add Property' link.}}
      {{#if view.canEdit}}
          {{#if view.category.customCanAddProperty }}
              <div>
                  <a href="#" {{action "showAddPropertyWindow" this target="view" }} >{{t installer.step7.config.addProperty}}...</a>
              </div>
          {{/if}}
      {{/if}}
    </div>
</div>
